home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_10.lha / 7_10 / qh_cut.c < prev    next >
Text File  |  1993-08-08  |  949b  |  32 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <process.h>
  6. include <debug.h>    /* DELETE */
  7. / Change
  8. /    old_queue_head  --  old_queue  --  old_queue_tail
  9. / into
  10. /    old_queue_head  --  new_queue
  11. /    new_queue_head  --  old_queue  --  old_queue_tail
  12. / where old_queue_head == this
  13. / Return new_queue_head.
  14. ueue_head *queue_head::cut()
  15.  
  16.    if (debug) /*DELETE*/ cerr << "queue_head" << this << "::cut()\n";
  17.    process_queue *oldQ = qh_queue;
  18.    queue_head *new_head = new queue_head(qh_mode, oldQ->q_max);
  19.    process_queue *newQ = new_head->qh_queue;
  20.  
  21.    // put the new head on the old queue
  22.    oldQ->q_head = new_head;
  23.    new_head->qh_queue = oldQ;
  24.  
  25.    // put the old head on the new queue
  26.    qh_queue = newQ;
  27.    newQ->q_head = this;
  28.  
  29.    if (debug) /*DELETE*/ cerr << "<<<< queue_head" << this << "::cut() <- " << new_head << "\n";
  30.    return new_head;
  31.  
  32.